package com.huang.foundation.entity.em;

import java.util.Objects;

/**
 * @Author HuangShen
 * @Date 2022/2/23 22:51
 * @Describe 发送消息 类型枚举
 */
public enum SmsType {
    LOGIN("login", 1314087, "登陆"),
    CHANGE_PASSWORD("changePassword", 1314091, "修改密码"),
    REGISTERED("registered", 1314095, "账号注册"),
    ;

    private String name;
    private Integer code;
    private String des;

    SmsType(String name, Integer code, String des) {
        this.name = name;
        this.code = code;
        this.des = des;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDes() {
        return des;
    }

    public void setDes(String des) {
        this.des = des;
    }

    public static SmsType getSmsTypeByCode(Integer code) {
        for (SmsType smsType : SmsType.values()) {
            if (Objects.equals(smsType.code, code)) {
                return smsType;
            }
        }
        return null;
    }

}
